package com.yihang.jdbcDemo.ftp;

import com.github.drapostolos.rdp4j.DirectoryPoller;
import com.github.drapostolos.rdp4j.spi.PolledDirectory;
import com.yihang.jdbcDemo.ftp.config.FtpDirectory;
import com.yihang.jdbcDemo.ftp.core.FtpClientTemplate;
import org.apache.commons.net.ftp.FTPClient;
import org.apache.commons.pool2.impl.GenericObjectPool;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.concurrent.TimeUnit;

/**
 * @version v1.0
 * @类描述：
 * @项目名称：
 * @包名： com.kuangchi.weixin.sginin.service
 * @类名称：CertificationFtp
 * @创建人：YIHANG.XU
 * @创建时间：2020/10/289:13 下午
 * @修改人：YIHANG.XU
 * @修改时间：2020/10/289:13 下午
 * @修改备注：
 * @Copyright
 */
@Component
public class CertificationFptFile implements Runnable {




    @Override
    public void run() {
        PolledDirectory polledDirectory = new FtpDirectory();
        DirectoryPoller dp = DirectoryPoller.newBuilder()
                .addPolledDirectory(polledDirectory)
                .addListener(new CertificationFtpListener())
                .enableFileAddedEventsForInitialContent()
                .setPollingInterval(1, TimeUnit.SECONDS)
                .start();


      /*  try {
            TimeUnit.HOURS.sleep(2);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        dp.stop();*/

    }
}
